package DeportManage;

public class Parcel {
	private String id_parcel;
	private int days_parcel;
	private double weight_parcel;
	
	private double height_parcel;
	private double width_parcel;
	private double length_parcel;
	/**
	 * Constructure of Parcel Class
	 * @param id   parcel ID
	 * @param days   days for stored
	 * @param weight   weight of parcel
	 * @param height   height of parcel
	 * @param width   width of parcel
	 * @param length   length of parcel
	 * @throws NotFormatParcelIDException 
	 * @throws OutRangeOfDaysException 
	 */
	public Parcel(String id, int days, double weight, double height, double width, double length) 
			throws NotFormatParcelIDException, OutRangeOfDaysException
	{
		String firstLetterOfID = id.substring(0,1);
		if(id.length() != 5)
			throw new NotFormatParcelIDException(id);
		if(!firstLetterOfID.equals("X") && !firstLetterOfID.equals("C"))
			throw new NotFormatParcelIDException(id);
		id_parcel = id;
		
		if(days > 14)
			throw new OutRangeOfDaysException(id);
		else
			days_parcel = days;
		
		weight_parcel = weight;
		height_parcel = height;
		width_parcel = width;
		length_parcel = length;
	}
	/**
	 * Method to get ID parcel
	 * @return the parcel ID
	 */
	public String getID()
	{
		return id_parcel;
	}
	/**
	 * Method to get days of stored
	 * @return the days
	 */
	public int getDays()
	{
		return days_parcel;
	}
	/**
	 * Method to get the weight of parcel
	 * @return parcel weight
	 */
	public double getWeight()
	{
		return weight_parcel;
	}
	/**
	 * Method to get height of parcel
	 * @return parcel height
	 */
	public double getHeight()
	{
		return height_parcel;
	}
	/**
	 * Method to get width of parcel
	 * @return parcel width
	 */
	public double getWidth()
	{
		return width_parcel;
	}
	/**
	 * Method to get length of parcel
	 * @return parcel length
	 */
	public double getLength()
	{
		return length_parcel;
	}
	/**
	 * Method to get Dimension of parcel
	 * The dimension shows like length x width x height
	 * @return a String to show the dimension
	 */
	public String getDimension()
	{
		return length_parcel + " x " + width_parcel + " x " + height_parcel; 
	}
	
}
